##---------------------fission related-------------
SPEC_ROOT_PATH = "./specs/function-"
KNOB_STRATEGY = 'ExecutionStrategy'
FISSION_ROUTER = "192.168.1.19:31314"
HTTP_STATUS_CODE = {"success": 200, "errors": 500, 'error': 500}
EXEC_TYPE = {"n": "newdeploy", 'p': 'poolmgr'}

##------------------Redis related----------------
REDIS_HOST = '10.110.2.172'
REDIS_PWD = 'nkIxA3xmfG'
REDIS_PORT = "6379"
REDIS_PREFIX = {'video': {"init": "video_id_", "split": "split_min_",
                          "extract": 'extract_frame_',"thumb":"thumb_frame_","compress":"compress_frame_"}}

##---------------Function/workflows related-------------------


FUNCTION_NAME = {'video': ['extract', 'classify','thumb'],#split',,'thumb','compress'"split",
                 "Airline Booking": ['long.ma.loyalty-ingest-metrics', 'long.ma.capture-stripe-metrics',
                                     'long.ma.charge-stripe-metrics', 'long.ma.collect-payment-metrics',
                                     'long.ma.confirm-booking-metrics', 'long.ma.loyalty-get-metrics',
                                     'long.ma.notify-booking-metrics', 'long.ma.reserve-booking-metrics', ],
                 "Facial Recognition": ['facedetection', 'facesearch',
                                        'indexface', 'persistmetadata', 'thumbnail'],
                 "Event Processing": ['eventinserter', 'formatforecast',
                                      'formatstatechanged', 'formattemperature', 'latest', 'list', 'ingest'],
                 "Hello Retail": ['event-writer','photo-assign', 'photo-processor', 'photo-receive', 'photo-report',
                                  'product-catalog-api', 'product-catalog-builder'],
                 "sebs":['503', '411', '311', '210_python', '210_node', '120'],
                 'intensive':['cpu','io','net','mem']
                 }
DEFAULT_FUNCTION_MEMORY = {'video': {"split": 1024, "extract": 1024, "classify": 0,'compress':1024,'thumb':0}}

SKEWED_CPU_LIST = [10,20,30,40,50,60,70,80,90,100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
SLIGHT_SKEWED_CPU_LIST = [20,40,60,80,100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
FINE_CPU_LIST = [100, 200, 300, 400, 500, 600, 700, 800, 900, 1000]
FINER_CPU_LIST = [100, 150, 200, 250, 300, 350, 400, 450, 500,
                  550, 600, 650, 700, 750, 800, 850, 900, 950, 1000, 1050]
ONE_CPU_CORE = [1000]

FINE_MEMORY_LIST = [64, 128, 256, 512, 1024]
FINER_MEMORY_LIST = [0]
INTENSIVE_DEFAULT_MEM = [500]

CPU_LIST_MAPPING = {"video": {"split": FINE_CPU_LIST, "extract": SLIGHT_SKEWED_CPU_LIST,
                              "classify": FINER_CPU_LIST, "compress": SKEWED_CPU_LIST,'thumb':SKEWED_CPU_LIST},
                    "intensive":{"cpu":ONE_CPU_CORE,'io':ONE_CPU_CORE,'net':ONE_CPU_CORE,'mem':ONE_CPU_CORE}}

MEMORY_LIST_MAPPING = {'video': {"split": FINE_MEMORY_LIST, "extract": FINE_MEMORY_LIST,
                                 "classify": FINER_MEMORY_LIST, "compress": [1024],'thumb':FINER_MEMORY_LIST},
                       'intensive':{"cpu":INTENSIVE_DEFAULT_MEM,'io':INTENSIVE_DEFAULT_MEM,
                                    'net':INTENSIVE_DEFAULT_MEM,'mem':INTENSIVE_DEFAULT_MEM}}

##-----------------slack re-distribution/function resize--------------------
OPTIMAL_GRID = 20  # slack is divided into X interval equally, 5, 10,20

FUNC_TEMPLATE = {
'video':{"split": {"prepare": [], 'meta-info': [], "slice": [], "overall": [], "request_id": [], "log_id": []}, \
    "extract": {"read-chunk": [], "extract-frame": [], 'update-frame': [], 'overall': [], "request_id": [],
                "log_id": []}, \
    "classify": {"load-model": [], 'prepare-data': [], 'detect': [], 'overall': [], "request_id": [], "log_id": []},
    "compress":{'prepare-data': [], 'compress': [], 'overall': [], "save-thumb": [], "delete-frame": [],"request_id":[], "log_id": []},
    "thumb":{'prepare-data': [], 'thumbnailer': [], 'overall': [], "save-thumb": [], "delete-frame": [],"request_id":[], "log_id": []}},
'intensive':{"cpu":{'pre-data':[],'exc':[],'e2e':[],'data_size':[],'data_unit':[],"request_id":[], "log_id": []},
             'io':{"exc":[], 'pre-data':[],"data(MB)":[],"request_id":[], "log_id": []},
             'net':{"exc":[],"pre-data":[],'e2e':[],"connect":[], "send":[],"close":[],
              "BW(MB/s)": [], "data(MB)":[],"request_id":[], "log_id": []},
             'mem':{'exc':[],'conn':[],'get':[],"request_id":[], "log_id": []},
}
}

PROFILE_FUNC_SIZE_SETUP = {'cpu':1000,'memory':500}
PROFILE_FUNC_INPUT_SETUP = {"video":{'split': "", "extract": "", 'classify': "", "compress": "", "thumb": ""},
"intensive":{'cpu':"-200kb",'net':'-5mb','mem':'-mem-50-mb','io':'-5mb'}}

CANDIDATE_SLACK_DISTRIBUTION = ['latency_weighted_steps', 'one_step', 'sensitive_weighted_steps', "optimal_step"]

'''
Concurrency: Maximum number of pods specialized concurrently to serve requests (default 500)
RequestsPerPod: Maximum number of concurrent requests that can be served by a specialized pod (default 1)
mincpu int: Minimum CPU to be assigned to pod (In millicore, minimum 1)
maxcpu int: Maximum CPU to be assigned to pod (In millicore, minimum 1)
minmemory int: Minimum memory to be assigned to pod (In megabyte)
maxmemory int: Maximum memory to be assigned to pod (In megabyte)
minscale int: Minimum number of pods (Uses resource inputs to configure HPA) (default 1)
maxscale int: Maximum number of pods (Uses resource inputs to configure HPA) (default 1)
targetcpu int: Target average CPU usage percentage across pods for scaling (default 80)
resources related fields: 'MinCpu', 'MaxCpu', 'MinMemory', 'MaxMemory',
'''
